﻿// (c) Copyright Fernando Cerqueira.
// This source is subject to the Microsoft Public License (Ms-PL).
// Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
// All other rights reserved.

using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Windows.Design;
using Microsoft.Windows.Design.Metadata;

namespace DevPhone.Controls.Design
{
    /// <summary>
    /// Provides design metadata.
    /// </summary>
    public class MetadataStore : IProvideAttributeTable
    {
        internal const string CommonProperties = "Common";
        internal const string BrushesProperties = "Brushes";
        internal const string UpDownProperties = "UpDown Properties";
        internal const string CalendarProperties = "Calendar Properties";
        internal const string ExpanderProperties = "Expander Properties";
        internal const string DropDownProperties = "DropDown Properties";
        internal const string DateTimePickerProperties = "DateTimePicker Properties";
        internal const string ListPickerPageProperties = "ListPickerPage Properties";
        internal const string CheckPickerPageProperties = "CheckPickerPage Properties";

        public AttributeTable AttributeTable
        {
            get
            {
                var attributeTableBuilder = new AttributeTableBuilder();

                // Hide primitives
                attributeTableBuilder.AddCustomAttributes(typeof(LoopingSelector), new ToolboxBrowsableAttribute(false));
                attributeTableBuilder.AddCustomAttributes(typeof(LoopingSelectorItem), new ToolboxBrowsableAttribute(false));
                attributeTableBuilder.AddCustomAttributes(typeof(ListPickerPage), new ToolboxBrowsableAttribute(false));
                attributeTableBuilder.AddCustomAttributes(typeof(CheckPickerPage), new ToolboxBrowsableAttribute(false));
                attributeTableBuilder.AddCustomAttributes(typeof(ListPickerItem), new ToolboxBrowsableAttribute(false));
                attributeTableBuilder.AddCustomAttributes(typeof(ListPickerItem), new DescriptionAttribute("Class that implements a container for the ListPickerPageControl and MultiselectPickerPageControl."));

                // UpDownControl
                attributeTableBuilder.AddTable(new UpDownControlMetadata().CreateTable());
                // CalendarControl
                attributeTableBuilder.AddTable(new CalendarControlMetadata().CreateTable());
                // ExpanderControl
                attributeTableBuilder.AddTable(new ExpanderControlMetadata().CreateTable());
                // DropDownControl
                attributeTableBuilder.AddTable(new DropDownControlMetadata().CreateTable());
                //TransitionService
                attributeTableBuilder.AddTable(new TransitionServiceMetadata().CreateTable());
                //WindowBoxService
                attributeTableBuilder.AddTable(new WindowBoxServiceMetadata().CreateTable());
                //DateTimePickerBase
                attributeTableBuilder.AddTable(new DateTimePickerBaseMetadata().CreateTable());
                //DateTimePickerBox
                attributeTableBuilder.AddTable(new DatePickerBoxMetadata().CreateTable());
                //TimeTimePickerBox
                attributeTableBuilder.AddTable(new TimePickerBoxMetadata().CreateTable());
                //ListPickerPageControl
                attributeTableBuilder.AddTable(new ListPickerPageControlMetadata().CreateTable());
                //MultiselectPickerPageControl
                attributeTableBuilder.AddTable(new CheckPickerPageControlMetadata().CreateTable());

                return attributeTableBuilder.CreateTable();
            }
        }
    }
}
